<template xmlns="http://www.w3.org/1999/html">
  <div class="app-container" style="width: 1000px">
    <editor v-model="content" :height="750" />
    <div slot="footer" class="dialog-footer" style="padding-left: 850px">
      <el-button type="primary" @click="submit">确定</el-button>
    </div>
  </div>
</template>

<script>
import { updateAgreement, getAgreement } from "@/api/admin/agreement";

export default {
  name: "AboutUs",
  data () {
    return {
      // 遮罩层
      loading: true,
      content: "",
      agreementId: 1,
    };
  },
  created () {
    this.getList();
  },
  methods: {
    getList () {
      this.loading = true;
      getAgreement(this.agreementId).then((response) => {
        this.agreementId = response.data.agreementId;
        this.content = response.data.content;
      });
    },
    submit () {
      let submitForm = { agreementId: this.agreementId, content: this.content };
      this.$confirm("是否确认修改该内容吗?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(function () {
          return updateAgreement(submitForm);
        })
        .then(() => {
          this.getList();
          this.msgSuccess("修改成功");
        })
        .catch(function () { });
    },
  },
};
</script>
<style>
.sudoku_row {
  display: flex;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
}

.sudoku_item {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  width: 25%;
  padding-top: 10px;
  padding-bottom: 10px;
}

.opacity {
  opacity: 0.4;
  background: #e5e5e5;
}

.sudoku_item img {
  margin-bottom: 3px;
  display: block;
}
</style>
